package com.financing.wap.service.impl;


import java.sql.SQLException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import com.financing.wap.common.CommonConstantUtil.CommonStatus;
import com.financing.wap.dao.IDstUserSettingDao;
import com.financing.wap.dto.DstUserSettingDTO;
import com.financing.wap.service.IDstUserSettingService;
import com.financing.wap.util.DTOdateSetUtil;
/**
 * dst_user_setting  
 * 用户提醒设置 业务访问层实现类
 * @author huqiyun
 *
 */
 
@Service("dstUserSettingService")
public class DstUserSettingServiceImpl implements IDstUserSettingService{

	@Autowired
	private IDstUserSettingDao dstUserSettingDao;

	@Override
	public int insert(DstUserSettingDTO dstUserSetting) throws SQLException {
		DTOdateSetUtil.setCreateInfo(dstUserSetting);
		DTOdateSetUtil.setUpdateInfo(dstUserSetting);
		dstUserSetting.setDeleteTag(CommonStatus.DELETE_TAG_NORMAL);
		return dstUserSettingDao.insert(dstUserSetting);
	}

	@Override
	public void update(DstUserSettingDTO dstUserSetting) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(dstUserSetting);
		dstUserSettingDao.update(dstUserSetting);
	}

	@Override
	public void updateForce(DstUserSettingDTO dstUserSetting) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(dstUserSetting);
		dstUserSettingDao.updateForce(dstUserSetting);
	}

	@Override
	public void delete(Integer id) throws SQLException {
		dstUserSettingDao.delete(id);
	}
	
	@Override
	public List<DstUserSettingDTO> queryList(DstUserSettingDTO dstUserSetting) throws SQLException {
		return dstUserSettingDao.queryList(dstUserSetting);
	}

	@Override
	public int queryListCount(DstUserSettingDTO dstUserSetting) throws SQLException {
		return dstUserSettingDao.queryListCount(dstUserSetting);
	}

	@Override
	public DstUserSettingDTO loadById(Integer id) throws SQLException {
		return dstUserSettingDao.loadById(id);
	}
 	@Override
	public DstUserSettingDTO queryListGetFirst(DstUserSettingDTO dstUserSetting)
			throws SQLException {
		 List<DstUserSettingDTO> queryList = queryList(dstUserSetting);
		 if(queryList==null||queryList.size()==0){
			 return new DstUserSettingDTO();
		 }
		 return queryList.get(0);
	}
}
